package com.learn.multi_thread.B_PracticeThread.Test04;

public class RedEnvelopeTest {
    /**
     * 假设：100块，分成3个红包，现在5人去抢，
     * 其中，红包是共享数据
     * 5个人是5条线程
     * 打印结果如下
     * xxxxx抢到了红包xxxx元
     * xxxxx抢到了红包xxxx元
     * xxxxx没抢到
     * xxxxx没抢到
     * @param args
     */
    public static void main(String[] args) {
        RedEnvelopeThread t1 = new RedEnvelopeThread();
        RedEnvelopeThread t2 = new RedEnvelopeThread();
        RedEnvelopeThread t3 = new RedEnvelopeThread();
        RedEnvelopeThread t4 = new RedEnvelopeThread();
        RedEnvelopeThread t5 = new RedEnvelopeThread();

        t1.setName("t1");
        t2.setName("t2");
        t3.setName("t3");
        t4.setName("t4");
        t5.setName("t5");

        t1.start();
        t2.start();
        t3.start();
        t4.start();
        t5.start();
    }
}
